#include <iostream>
#include <vector>

using namespace std;

const int task_num = 3;  //可用任务数量

void PrintLOG()
{
    cout << "执行打印日志的任务" << endl;
}

void InsertSQL()
{
    cout << "执行SQL数据插入的任务" << endl;
}

void NetRequst()
{
    cout << "执行网络请求的任务" << endl;
}

typedef void (*func_t)();

class Task
{
public:
    Task()
    {
        // 装载任务
        funcs.push_back(PrintLOG);
        funcs.push_back(InsertSQL);
        funcs.push_back(NetRequst);
    }

    void Execute(int command)
    {
        cerr << "command: " << command << endl;
        if (command >= 0 && command < funcs.size())
            funcs[command](); // 执行对应任务
        else
            cerr << "Can't find this Task! " << endl;
    }

private:
    vector<func_t> funcs; // 存储函数的vector
};